<template src="./template.html"></template>

<style src="./style.css" scoped></style>

<script>
    import jsbridge from 'utils/jsbridge';
    import modal from 'utils/modal';
    const webview = weex.requireModule('webview');

    let suffix = '/Goods/getdetail.html?gid=';
    let domain_test = 'https://mobile2.mideav.com';
    let domain_prod = 'https://mobile.mideav.com';

    export default{
        data(){
            return {
                url: null,
                goodsId: null //商品ID
            }
        },
        created(){
            let self = this;
            let bundleUrl = weex.config.bundleUrl;
            bundleUrl = bundleUrl.split("goodsId=")[1];
            if(!bundleUrl) {
                modal.toast("该商品不存在");
                return false;
            }
            self.goodsId = bundleUrl;
            jsbridge.getEnv(res => {
                if(res){
                    self.url = domain_prod + suffix + self.goodsId;
                } else self.url = domain_test + suffix + self.goodsId;
            });
        },
        methods: {
            start() {
            },
            finish() {
            },
            error() {
                modal.toast("加载商品详情失败");
            }
        }
    }
</script>
